<?php
include('./connection.php');
	$id = $_GET['id'];
	$name = $_GET['name'];
        $resp = $_GET['resp'];

	$sql = "SELECT name,content FROM care_interconsulta_adjuntos$resp WHERE id_interconsulta=".$id." AND name='".$name."'";

	if (!strcmp("mysql", $dbtype))
        {
            mysql_connect($dbhostname, $dbusername, $dbpassword);
            mysql_select_db($dbname);
            $res = mysql_query($sql);
            $row = mysql_fetch_array($res, MYSQL_ASSOC);
        }
	$nombreC= explode('.',$row['name']);
 	$type = $nombreC[sizeOf($nombreC)-1];
 	$bytes = $row['content'];

	header("Content-type: ".$type);
	print $bytes;
?>
